﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace AtKardesler.Cache
{
    public class CacheManager
    {
        private static CacheManager _instance;
        private Hashtable _cache;

        static CacheManager()
        {
            _instance = new CacheManager();
        }

        protected CacheManager()
        {
            InitializeCacheManager();
        }

        internal void InitializeCacheManager()
        {
            _cache = new Hashtable();
        }

        public static CacheManager Instance
        {
            get
            {
                return _instance;
            }
        }

        public Hashtable Cache
        {
            get
            {
                return _cache;
            }
        }

        public void AddItemToCache(string key, object value)
        {
            try
            {
                if (!string.IsNullOrEmpty(key) && value != null)
                {
                    this._cache.Add(key, value);
                }
            }
            catch (Exception ex)
            {

            }
        }

        public object GetItemFromCache(string key)
        {
            return _cache[key];
        }
    }
}
